package ch.unisi.inf.pfii.teamred.pacman.model;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * @author luca.vignola@lu.unisi.ch
 * 
 */
public abstract class AiControlledCreature extends Creature {

	private static final int POINTS = 200;
	private static final Direction DEFAULT_DIRECTION = Direction.UP;

	private final Controller controller;

	public AiControlledCreature(final Position startPosition,
			final Direction currentDirection, final Controller controller) {
		super(startPosition, currentDirection, POINTS);
		this.controller = controller;
	}

	public final void setupController(
			final HashMap<Direction, ArrayList<Block>> neighbors,
			final Position pacmanPosition) {
		controller.setUp(neighbors, pacmanPosition, getCurrentPosition(),
				getCurrentDirection(), isVulnerable());
	}

	public final Controller getController() {
		return controller;
	}

	public final void reset() {
		setInvulnerable();
		setCurrentPosition(getStartPosition());
		setCurrentDirection(DEFAULT_DIRECTION);
		setAlive();
	}

	public boolean isControlledByPlayer() {
		return false;
	}

}
